<!DOCTYPE html	PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
	xmlns:s="http://sduept.security.el/func" xmlns:p="http://primefaces.org/ui"
	template="/template/template.xhtml">

	<ui:define name="head">
		<link rel="stylesheet" href="/resources/bootstrap/css/bootstrap-datetimepicker.min.css" />
	</ui:define>
	<style>
.ui-spinner input {
	vertical-align: middle;
	text-align: left;
	padding-right: 20px;
	width: 80px;
}
table.dataTable thead>tr>th {
	padding-right: 0px;
}
</style>
	<ui:define name="content">
		<div class="nav-tabs-custom full-center-content-scroll-noheader">
			<ul class="nav nav-tabs pull-left">
				<li class="active"><a href="#faultPanel" data-toggle="tab">故障持续时间</a></li>
				<li><a href="#protectPanel" id="protectTab" data-toggle="tab">保护动作时间</a></li>
				<li><a href="#breakerPanel" id="breakerTab" data-toggle="tab">断路器动作时间</a></li>
			</ul>
			<div class="tab-content no-padding">
				<div class="chart tab-pane active" id="faultPanel" style="position: relative">
					<div class="row">
						<div class="col-sm-12">
							<div class="box-header with-border">
								<h:form id="faultQueryForm">
									<p:outputLabel value="年：" />
									<input type="text" id="startYear"
										style="width: 80px; height: 30px; text-align: center; margin-right: 5px;" />
									<p:outputLabel value="至" style="margin-right:5px;" />
									<input type="text" id="endYear"
										style="width: 80px; height: 30px; text-align: center; margin-right: 10px;" />
									<p:outputLabel value="电压：" style="margin-left:10px;" />
									<h:selectOneMenu id="vol" style="width:110px;margin-right:20px;height:30px">
										<f:selectItem itemValue="0" itemLabel="220kV及以上"/>
										<f:selectItem itemValue="220" itemLabel="220kV"/>
									   <f:selectItem itemValue="500" itemLabel="500kV"/>
									</h:selectOneMenu>
									<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:10px"
										onclick="getQueryData()" />
									<!-- <p:commandButton value="数据维护" icon="ui-icon-document" oncomplete="PF('faultTimeDlg').show()"
										actionListener="#{faultTimeAnalysisController.initFaultTimeData}" 
										rendered="#{s:hasPermission(session,'tjfx_xtgzsjfx_gzcxsjsjwh')}" 
										update="faultForm:faultTimeDlg"/> -->
								</h:form>
							</div>
						</div>
						<div class="col-xs-12">
							<div class="info-box bg-blue">
								<span class="info-box-icon"> <i class='icon ion-pie-graph'></i>
								</span>
								<div class="info-box-content">
									<ul>
										<li id="a_title" class="info-box-number"></li>
										<li id="a_li1" class="info-box-text"></li>
										<li id="a_li2" class="info-box-text"></li>
									</ul>
								</div>
							</div>
						</div>
						<div class="col-xs-12">
							<div class="col-md-5">
								<div class="box box-primary">
									<div id='faultDetail' style="height: 500px;"></div>
								</div>
							</div>
							<div class="col-md-7">
								<div class="box box-primary">
									<div id='faultAvgCount' style="height: 500px;"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="chart tab-pane" id="protectPanel" style="position: relative">
					<div class="row">
						<div class="col-xs-12">
							<div class="box-header with-border">
								<h:form id="protectQueryForm">
									<p:outputLabel value="年：" />
									<input type="text" id="startYear1"
										style="width: 80px; height: 30px; text-align: center; margin-right: 5px;" />
									<p:outputLabel value="至" style="margin-right:5px;" />
									<input type="text" id="endYear1"
										style="width: 80px; height: 30px; text-align: center; margin-right: 10px;" />
									<p:outputLabel value="电压：" style="margin-left:10px;" />
									<h:selectOneMenu id="vol1" style="width:110px;margin-right:20px;height:30px">
										<f:selectItem itemValue="0" itemLabel="220kV及以上"/>
										<f:selectItem itemValue="220" itemLabel="220kV"/>
									   <f:selectItem itemValue="500" itemLabel="500kV"/>
										<!-- <f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
											itemValue="#{item}" itemLabel="#{item}kV" /> -->
									</h:selectOneMenu>
									<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:10px"
										onclick="getProtectQueryData()" />
									<!-- <p:commandButton value="数据维护" icon="ui-icon-document" oncomplete="PF('protectActDlg').show()"
										actionListener="#{faultTimeAnalysisController.initProtectActTimeData}" 
										rendered="#{s:hasPermission(session,'tjfx_xtgzsjfx_bhdzsjsjwh')}" 
										update="protectForm:protectActDlg"/> -->
								</h:form>
							</div>
						</div>
						<div class="col-xs-12">
							<div class="info-box bg-blue">
								<span class="info-box-icon"> <i class='icon ion-pie-graph'></i>
								</span>
								<div class="info-box-content">
									<ul>
										<li id="b_title" class="info-box-number"></li>
										<li id="b_li1" class="info-box-text"></li>
										<li id="b_li2" class="info-box-text"></li>
									</ul>
								</div>
							</div>
						</div>
						<div class='col-sm-12'>
							<div class="col-md-5">
								<div class='box box-primary'>
									<!-- <div id='protectDetail' style="height: 500px;text-align:center;color:grey;font-size:16px;font-weight:bold;"></div> -->
									<div id='protectDetail' style="height: 500px;"></div>
								</div>
							</div>
							<div class="col-md-7">
								<div class='box box-primary'>
									<div id='protectAvgCount' style="height: 500px;"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="chart tab-pane" id="breakerPanel" style="position: relative">
					<div class="row">
						<div class="col-xs-12">
							<div class="box-header with-border">
								<h:form id="breakerQueryForm">
									<p:outputLabel value="年：" />
									<input type="text" id="startYear2"
										style="width: 80px; height: 30px; text-align: center; margin-right: 5px;" />
									<p:outputLabel value="至" style="margin-right:5px;" />
									<input type="text" id="endYear2"
										style="width: 80px; height: 30px; text-align: center; margin-right: 10px;" />
									<p:outputLabel value="电压：" style="margin-left:10px;" />
									<h:selectOneMenu id="vol2" style="width:110px;margin-right:20px;height:30px">
										<f:selectItem itemValue="0" itemLabel="220kV及以上"/>
										<f:selectItem itemValue="220" itemLabel="220kV"/>
									   <f:selectItem itemValue="500" itemLabel="500kV"/>
									</h:selectOneMenu>
									<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:10px"
										onclick="getBreakerQueryData()" />
									<!-- <p:commandButton value="数据维护" icon="ui-icon-document" oncomplete="PF('breakerDlg').show()"
										actionListener="#{faultTimeAnalysisController.initBreakerTimeData}"
										rendered="#{s:hasPermission(session,'tjfx_xtgzsjfx_dlqdzsjsjwh')}"
										update="breakerForm:breakerDlg"/> -->
								</h:form>
							</div>
						</div>
						<div class="col-xs-12">
							<div class="info-box bg-blue">
								<span class="info-box-icon"> <i class='icon ion-pie-graph'></i>
								</span>
								<div class="info-box-content">
									<ul>
										<li id="c_title" class="info-box-number"></li>
										<li id="c_li1" class="info-box-text"></li>
										<li id="c_li2" class="info-box-text"></li>
									</ul>
								</div>
							</div>
						</div>
						<div class='col-sm-12'>
							<div class="col-md-5">
								<div class='box box-primary'>
									<div id='breakerDetail' style="height: 500px;"></div>
								</div>
							</div>
							<div class="col-md-7">
								<div class='box box-primary'>
									<div id='breakerCount' style="height: 500px;"></div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<h:inputHidden id="chartStartYear" value="#{faultTimeAnalysisController.chartStartYear}"></h:inputHidden>
			<h:inputHidden id="chartEndYear" value="#{faultTimeAnalysisController.chartEndYear}"></h:inputHidden>
			<h:inputHidden id="chartVoltage" value="#{faultTimeAnalysisController.chartVoltage}"></h:inputHidden>
			<!-- 故障时持续时间展示页面 -->
			<h:form id="faultForm">
				<p:confirmDialog global="true" showEffect="fade" hideEffect="fade">
					<p:commandButton value="是" type="button" styleClass="ui-confirmdialog-yes" icon="ui-icon-check" />
					<p:commandButton value="否" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
				</p:confirmDialog>
				<p:dialog widgetVar="faultTimeDlg" header="故障持续时间数据维护" modal="true" id="faultTimeDlg"
					width="1300" height="700" onShow="initQueryYear()">
					<p:growl id="msgs" showDetail="true" />
					<div class="box box-primary box-solid with-border" style="padding: 7px;">
						<p:remoteCommand name="selectFaultQueryYear"
							actionListener="#{faultTimeAnalysisController.selectFaultQueryYear}" />
						<h:panelGrid id="toolbars" columns="13" style="margin-left:10px">
							<p:selectOneRadio id="queryType" value="#{faultTimeAnalysisController.queryType}"
								style="margin-right:5px;">

								<p:ajax event="valueChange" listener="#{faultTimeAnalysisController.faultTimeQuery()}"
									oncomplete="initQueryYear()" update="toolbars toolbar faultTab" />

								<f:selectItem itemLabel="年指标维护" itemValue="0" />
								<f:selectItem itemLabel="月指标维护" itemValue="1" />
							</p:selectOneRadio>
							<p:outputLabel value="年：" />
							<input type="text" id="mYear" onchange="changeFaultQueryYear()"
								style="width: 80px; text-align: center; margin-right: 10px;" />
							<p:outputLabel value="月：" style="margin-bottom:10px;text-align:center;margin-top:7px;" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 1}"
								style="width:60px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 0}"
								disabled="#{faultTimeAnalysisController.queryType == 0}"
								style="width:60px;margin-right:10px;height:30px;background:#dcdcdc;color:transparent">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<p:outputLabel value="电压等级 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mVoltage}"
								style="width:110px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="220kV及以上" />
								<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
									itemValue="#{item}" itemLabel="#{item}kV" />
							</h:selectOneMenu>
							<p:outputLabel value="子公司 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.subCompany}"
								style="width:130px;height:30px;margin-right:10px;">
								<f:selectItem itemLabel="全部" itemValue="全部" />
								<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
							</h:selectOneMenu>
							<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.faultTimeQuery()}" update="faultTab" />
							<p:commandButton value="重置" icon="ui-icon-refresh" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.resetFaultTimeCount()}"
								oncomplete="initQueryYear()" update="toolbars faultTab" />
							<p:commandButton value="统计当前" icon="fa fa-bar-chart" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.countFaultTime}"
								update="faultTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会覆盖当前年月的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
							<p:commandButton value="统计全部" icon="fa fa-bar-chart"
								actionListener="#{faultTimeAnalysisController.countAllFaultTime}"
								update="faultTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会删除所有的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</h:panelGrid>
					</div>
					<p:toolbar id="toolbar">
						<f:facet name="left">
							<p:commandButton value="编辑" icon="ui-icon-pencil" id="edit" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectFaultTimeCount.id == null}"
								oncomplete="PF('faultTimeEditDlg').show()" update="faultTimeEditForm:faultTimeEditDlg" />
							<p:commandButton value="删除" icon="ui-icon-trash" id="delete" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectFaultTimeCount.id == null}"
								actionListener="#{faultTimeAnalysisController.deleteFaultTimeCount()}" update="faultTab">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
					<p:dataTable value="#{faultTimeAnalysisController.faultTimeCounts}" var="record"
						paginator="true" id="faultTab" emptyMessage="无记录" rowKey="#{record.id}" rowIndexVar="ite"
						rows="15" selection="#{faultTimeAnalysisController.selectFaultTimeCount}"
						paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="15,50,100" paginatorPosition="bottom"
						style="text-align:center;margin-top:3px">
						<f:facet name="{Customization}">
							<p:outputLabel value="总计：#{faultTimeAnalysisController.faultTimeCounts.size()} 条记录"
								style="margin-right:20px;" />
						</f:facet>
						<p:ajax event="rowSelectRadio" update="faultForm:edit faultForm:delete" />
						<p:column selectionMode="single" width="60" style="text-align:center" />
						<p:column width="60" headerText="序号">
							<h:outputText value="#{ite+1}" />
						</p:column>
						<p:column headerText="子公司">
							<p:outputLabel value="#{record.subCompany}" />
						</p:column>
						<p:column headerText="故障持续时间平均值（ms）">
							<!-- avgTimeDetail -->
							<p:commandLink style="color: red"
								actionListener="#{faultTimeAnalysisController.avgTimeDetail(record)}" title="详细"
								update=":avgTimeForm:avgTimeTab" oncomplete="PF('avgTimeDlg').show()">
								<h:outputText value="#{record.faultTimeAve}" />
							</p:commandLink>
						</p:column>
						<p:column headerText="时间">
							<p:outputLabel value="#{record.year}" />
							<p:outputLabel value="-#{record.month}" rendered="#{record.month != null}" />
						</p:column>
						<p:column headerText="电压等级(kV)">
							<p:outputLabel value="#{record.voltage}" />
							<p:outputLabel rendered="#{record.voltage == null}" value="——" />
						</p:column>
						<p:column headerText="数据来源">
							<p:outputLabel value="#{record.status==0?'系统统计':'人工创建'}" />
						</p:column>
					</p:dataTable>
				</p:dialog>
			</h:form>
			<!-- 故障时持续时间编辑页面 -->
			<h:form id="faultTimeEditForm">
				<p:dialog id="faultTimeEditDlg" widgetVar="faultTimeEditDlg" header="故障持续时间 编辑" width="400"
					height="350" modal="true">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" icon="ui-icon-disk" validateClient="true"
								actionListener="#{faultTimeAnalysisController.saveFaultTimeCount}"
								update=" faultForm:msgs  faultForm:faultTab faultForm:toolbar"
								oncomplete="PF('faultTimeEditDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:panelGrid>
						<p:row>
							<p:column>
								<h:outputText value="年" />
							</p:column>
							<p:column>
								<p:spinner style="margin-right:20px;" min="0"
									value="#{faultTimeAnalysisController.selectFaultTimeCount.year}" />
							</p:column>
						</p:row>
						<p:row rendered="#{faultTimeAnalysisController.queryType == 1}">
							<p:column>
								<h:outputText value="月" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectFaultTimeCount.month}"
									style="width:80px;height:30px">
									<f:selectItems value="#{faultTimeAnalysisController.months}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="子公司" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectFaultTimeCount.subCompany}"
									style="width:130px;height:30px;margin-right:10px;">
									<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="电压等级" />
							</p:column>
							<p:column>
								<p:selectOneRadio value="#{faultTimeAnalysisController.selectFaultTimeCount.voltage}">
									<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
										itemValue="#{item}" itemLabel="#{item}kV" />
								</p:selectOneRadio>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="故障持续时间平均值" />
							</p:column>
							<p:column>
								<p:inputText value="#{faultTimeAnalysisController.selectFaultTimeCount.faultTimeAve}" />
							</p:column>
						</p:row>
					</p:panelGrid>
				</p:dialog>
			</h:form>
			<!-- 保护动作时间展示页面 -->
			<h:form id="protectForm">
				<p:dialog widgetVar="protectActDlg" header="保护动作时间数据维护" modal="true" id="protectActDlg"
					width="1300" height="700" onShow="initProtectQueryYear()">
					<div class="box box-primary box-solid with-border" style="padding: 7px;">
						<p:remoteCommand name="selectProtectQueryYear"
							actionListener="#{faultTimeAnalysisController.selectProtectQueryYear()}" />
						<h:panelGrid id="toolbars" columns="13" style="margin-left:10px">
							<p:selectOneRadio value="#{faultTimeAnalysisController.queryType}" style="margin-right:5px;">

								<p:ajax event="valueChange" listener="#{faultTimeAnalysisController.protectActTimeQuery()}"
									oncomplete="initProtectQueryYear()" update="toolbars toolbar protectTab" />

								<f:selectItem itemLabel="年指标维护" itemValue="0" />
								<f:selectItem itemLabel="月指标维护" itemValue="1" />
							</p:selectOneRadio>
							<p:outputLabel value="年：" />
							<input type="text" id="mYear1" onchange="changeProtectQueryYear()"
								style="width: 80px; text-align: center; margin-right: 10px;" />
							<p:outputLabel value="月：" style="margin-bottom:10px;text-align:center;margin-top:7px;" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 1}"
								style="width:60px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 0}"
								disabled="#{faultTimeAnalysisController.queryType == 0}"
								style="width:60px;margin-right:10px;height:30px;background:#dcdcdc;color:transparent">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<p:outputLabel value="电压等级 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mVoltage}"
								style="width:110px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="220kV及以上" />
								<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
									itemValue="#{item}" itemLabel="#{item}kV" />
							</h:selectOneMenu>
							<p:outputLabel value="子公司 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.subCompany}"
								style="width:130px;height:30px;margin-right:10px;">
								<f:selectItem itemLabel="全部" itemValue="全部" />
								<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
							</h:selectOneMenu>
							<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.protectActTimeQuery()}" update="protectTab" />
							<p:commandButton value="重置" icon="ui-icon-refresh" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.resetProtectActTimeCount()}"
								oncomplete="initProtectQueryYear()" update="toolbars protectTab" />
							<p:commandButton value="统计当前" icon="fa fa-bar-chart" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.countProtectActTime}"
								update="protectTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会覆盖当前年月的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
							<p:commandButton value="统计全部" icon="fa fa-bar-chart"
								actionListener="#{faultTimeAnalysisController.countAllProtectActTime}"
								update="protectTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会删除所有的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</h:panelGrid>
					</div>
					<p:toolbar id="toolbar">
						<f:facet name="left">
							<p:commandButton value="编辑" icon="ui-icon-pencil" id="edit" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectProtectActTimeCount.id == null}"
								oncomplete="PF('protectEditDlg').show()" update="protectEditForm:protectEditDlg" />
							<p:commandButton value="删除" icon="ui-icon-trash" id="delete" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectProtectActTimeCount.id == null}"
								actionListener="#{faultTimeAnalysisController.deleteProtectActCount()}" update="protectTab">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
					<p:dataTable value="#{faultTimeAnalysisController.protectActTimeCounts}" var="record"
						paginator="true" id="protectTab" emptyMessage="无记录" rowKey="#{record.id}" rowIndexVar="ite"
						rows="15" selection="#{faultTimeAnalysisController.selectProtectActTimeCount}"
						paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="15,50,100" paginatorPosition="bottom"
						style="text-align:center;margin-top:3px">
						<f:facet name="{Customization}">
							<p:outputLabel value="总计：#{faultTimeAnalysisController.protectActTimeCounts.size()} 条记录"
								style="margin-right:20px;" />
						</f:facet>
						<p:ajax event="rowSelectRadio" update="protectForm:edit protectForm:delete" />
						<p:column selectionMode="single" width="60" style="text-align:center" />
						<p:column width="60" headerText="序号">
							<h:outputText value="#{ite+1}" />
						</p:column>
						<p:column headerText="子公司">
							<p:outputLabel value="#{record.subCompany}" />
						</p:column>
						<p:column headerText="故障持续时间平均值（ms）">
							<p:commandLink style="color: red"
								actionListener="#{faultTimeAnalysisController.protectTimeDetail(record)}" title="详细"
								update=":avgTimeForm:avgTimeTab" oncomplete="PF('avgTimeDlg').show()">
								<h:outputText value="#{record.actTimeAve}" />
							</p:commandLink>
						</p:column>
						<p:column headerText="时间">
							<p:outputLabel value="#{record.year}" />
							<p:outputLabel value="-#{record.month}" rendered="#{record.month != null}" />
						</p:column>
						<p:column headerText="电压等级(kV)">
							<p:outputLabel value="#{record.voltage}" />
							<p:outputLabel rendered="#{record.voltage == null}" value="——" />
						</p:column>
						<p:column headerText="数据来源">
							<p:outputLabel value="#{record.status==0?'系统统计':'人工创建'}" />
						</p:column>
					</p:dataTable>
				</p:dialog>
			</h:form>
			<!-- 保护动作时间编辑页面 -->
			<h:form id="protectEditForm">
				<p:dialog id="protectEditDlg" widgetVar="protectEditDlg" header="保护动作时间 编辑" width="400"
					height="350" modal="true">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" icon="ui-icon-disk" validateClient="true"
								actionListener="#{faultTimeAnalysisController.saveProtectActCount}"
								update=" faultForm:msgs protectForm:protectTab protectForm:toolbar"
								oncomplete="PF('protectEditDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:panelGrid>
						<p:row>
							<p:column>
								<h:outputText value="年" />
							</p:column>
							<p:column>
								<p:spinner style="margin-right:20px;" min="0"
									value="#{faultTimeAnalysisController.selectProtectActTimeCount.year}" />
							</p:column>
						</p:row>
						<p:row rendered="#{faultTimeAnalysisController.queryType == 1}">
							<p:column>
								<h:outputText value="月" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectProtectActTimeCount.month}"
									style="width:80px;height:30px">
									<f:selectItems value="#{faultTimeAnalysisController.months}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="子公司" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectProtectActTimeCount.subCompany}"
									style="width:130px;height:30px;margin-right:10px;">
									<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="电压等级" />
							</p:column>
							<p:column>
								<p:selectOneRadio value="#{faultTimeAnalysisController.selectProtectActTimeCount.voltage}">
									<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
										itemValue="#{item}" itemLabel="#{item}kV" />
								</p:selectOneRadio>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="保护时间平均值" />
							</p:column>
							<p:column>
								<p:inputText value="#{faultTimeAnalysisController.selectProtectActTimeCount.actTimeAve}" />
							</p:column>
						</p:row>
					</p:panelGrid>
				</p:dialog>
			</h:form>
			<!-- 断路器动作时间展示页面 -->
			<h:form id="breakerForm">
				<p:dialog widgetVar="breakerDlg" header="断路器动作时间数据维护" modal="true" id="breakerDlg" width="1300"
					height="700" onShow="initBreakerQueryYear();">
					<div class="box box-primary box-solid with-border" style="padding: 7px;">
						<p:remoteCommand name="selectBreakerQueryYear"
							actionListener="#{faultTimeAnalysisController.selectBreakerQueryYear}" />
						<h:panelGrid id="toolbars" columns="13" style="margin-left:10px">
							<p:selectOneRadio value="#{faultTimeAnalysisController.queryType}" style="margin-right:5px;">

								<p:ajax event="valueChange" listener="#{faultTimeAnalysisController.breakerActTimeQuery()}"
									oncomplete="initBreakerQueryYear();" update="toolbars toolbar breakerTab" />

								<f:selectItem itemLabel="年指标维护" itemValue="0" />
								<f:selectItem itemLabel="月指标维护" itemValue="1" />
							</p:selectOneRadio>
							<p:outputLabel value="年：" />
							<input type="text" id="mYear2" onchange="changeBreakerQueryYear()"
								style="width: 80px; text-align: center; margin-right: 10px;" />
							<p:outputLabel value="月：" style="margin-bottom:10px;text-align:center;margin-top:7px;" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 1}"
								style="width:60px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<h:selectOneMenu value="#{faultTimeAnalysisController.mMonth}"
								rendered="#{faultTimeAnalysisController.queryType == 0}"
								disabled="#{faultTimeAnalysisController.queryType == 0}"
								style="width:60px;margin-right:10px;height:30px;background:#dcdcdc;color:transparent">
								<f:selectItem itemValue="0" itemLabel="全年" />
								<f:selectItems value="#{faultTimeAnalysisController.months}" />
							</h:selectOneMenu>
							<p:outputLabel value="电压等级 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.mVoltage}"
								style="width:110px;margin-right:10px;height:30px">
								<f:selectItem itemValue="0" itemLabel="220kV及以上" />
								<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
									itemValue="#{item}" itemLabel="#{item}kV" />
							</h:selectOneMenu>
							<p:outputLabel value="子公司 ：" />
							<h:selectOneMenu value="#{faultTimeAnalysisController.subCompany}"
								style="width:130px;height:30px;margin-right:10px;">
								<f:selectItem itemLabel="全部" itemValue="全部" />
								<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
							</h:selectOneMenu>
							<p:commandButton value="查询" icon="ui-icon-search" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.breakerActTimeQuery()}" update="breakerTab" />
							<p:commandButton value="重置" icon="ui-icon-refresh" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.resetBreakerActTimeCount()}"
								oncomplete="initBreakerQueryYear();" update="toolbars breakerTab" />
							<p:commandButton value="统计当前" icon="fa fa-bar-chart" style="margin-right:5px;"
								actionListener="#{faultTimeAnalysisController.countBreakerActTime}"
								update="breakerTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会覆盖当前年月的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
							<p:commandButton value="统计全部" icon="fa fa-bar-chart"
								actionListener="#{faultTimeAnalysisController.countAllBreakerActTime}"
								update="breakerTab faultForm:msgs">
								<p:confirm header="提示" message="重新统计会删除所有的统计信息，确定重新统计吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</h:panelGrid>
					</div>
					<p:toolbar id="toolbar">
						<f:facet name="left">
							<p:commandButton value="编辑" icon="ui-icon-pencil" id="edit" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectBreakerActTimeCount.id == null}"
								oncomplete="PF('breakerEditDlg').show()" update="breakerEditForm:breakerEditDlg" />
							<p:commandButton value="删除" icon="ui-icon-trash" id="delete" style="margin-right:5px;"
								disabled="#{faultTimeAnalysisController.selectBreakerActTimeCount.id == null}"
								actionListener="#{faultTimeAnalysisController.deleteBreakerActCount()}" update="breakerTab">
								<p:confirm header="提示" message="确定删除该记录吗?" icon="ui-icon-alert" />
							</p:commandButton>
						</f:facet>
					</p:toolbar>
					<p:dataTable value="#{faultTimeAnalysisController.breakerActTimeCounts}" var="record"
						paginator="true" id="breakerTab" emptyMessage="无记录" rowKey="#{record.id}" rowIndexVar="ite"
						rows="15" selection="#{faultTimeAnalysisController.selectBreakerActTimeCount}"
						paginatorTemplate="{Customization} {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
						rowsPerPageTemplate="15,50,100" paginatorPosition="bottom"
						style="text-align:center;margin-top:3px">
						<f:facet name="{Customization}">
							<p:outputLabel value="总计：#{faultTimeAnalysisController.breakerActTimeCounts.size()} 条记录"
								style="margin-right:20px;" />
						</f:facet>
						<p:ajax event="rowSelectRadio" update="breakerForm:edit breakerForm:delete" />
						<p:column selectionMode="single" width="60" style="text-align:center" />
						<p:column width="60" headerText="序号">
							<h:outputText value="#{ite+1}" />
						</p:column>
						<p:column headerText="子公司">
							<p:outputLabel value="#{record.subCompany}" />
						</p:column>
						<p:column headerText="断路器动作时间平均值（ms）">
							<p:commandLink style="color: red"
								actionListener="#{faultTimeAnalysisController.breakerActTimeDetail(record)}" title="详细"
								update=":avgTimeForm:avgTimeTab" oncomplete="PF('avgTimeDlg').show()">
								<h:outputText value="#{record.actionTimeInterval}" />
							</p:commandLink>
						</p:column>
						<p:column headerText="时间">
							<p:outputLabel value="#{record.year}" />
							<p:outputLabel value="-#{record.month}" rendered="#{record.month != null}" />
						</p:column>
						<p:column headerText="电压等级(kV)">
							<p:outputLabel value="#{record.voltage}" />
							<p:outputLabel rendered="#{record.voltage == null}" value="——" />
						</p:column>
						<p:column headerText="数据来源">
							<p:outputLabel value="#{record.status==0?'系统统计':'人工创建'}" />
						</p:column>
					</p:dataTable>
				</p:dialog>
			</h:form>
			<!-- 断路器动作时间编辑页面 -->
			<h:form id="breakerEditForm">
				<p:dialog id="breakerEditDlg" widgetVar="breakerEditDlg" header="断路器动作时间 编辑" width="400"
					height="350" modal="true">
					<p:toolbar>
						<f:facet name="left">
							<p:commandButton value="保存" icon="ui-icon-disk" validateClient="true"
								actionListener="#{faultTimeAnalysisController.saveBreakerActCount}"
								update=" faultForm:msgs breakerForm:breakerTab breakerForm:toolbar"
								oncomplete="PF('breakerEditDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:panelGrid>
						<p:row>
							<p:column>
								<h:outputText value="年" />
							</p:column>
							<p:column>
								<p:spinner style="margin-right:20px;" min="0"
									value="#{faultTimeAnalysisController.selectBreakerActTimeCount.year}" />
							</p:column>
						</p:row>
						<p:row rendered="#{faultTimeAnalysisController.queryType == 1}">
							<p:column>
								<h:outputText value="月" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectBreakerActTimeCount.month}"
									style="width:80px;height:30px">
									<f:selectItems value="#{faultTimeAnalysisController.months}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="子公司" />
							</p:column>
							<p:column>
								<h:selectOneMenu value="#{faultTimeAnalysisController.selectBreakerActTimeCount.subCompany}"
									style="width:130px;height:30px;margin-right:10px;">
									<f:selectItems value="#{faultTimeAnalysisController.subCompanys}" />
								</h:selectOneMenu>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="电压等级" />
							</p:column>
							<p:column>
								<p:selectOneRadio value="#{faultTimeAnalysisController.selectBreakerActTimeCount.voltage}">
									<f:selectItems value="#{faultTimeAnalysisController.voltages}" var="item"
										itemValue="#{item}" itemLabel="#{item}kV" />
								</p:selectOneRadio>
							</p:column>
						</p:row>
						<p:row>
							<p:column>
								<h:outputText value="保护时间平均值" />
							</p:column>
							<p:column>
								<p:inputText
									value="#{faultTimeAnalysisController.selectBreakerActTimeCount.actionTimeInterval}" />
							</p:column>
						</p:row>
					</p:panelGrid>
				</p:dialog>
			</h:form>
			<h:form id="avgTimeForm">
				<p:dialog id="avgTimeDlg" widgetVar="avgTimeDlg" header=" 详细" width="930" height="570"
					modal="true">
					<p:toolbar>
						<f:facet name="left">
							<p:outputLabel value="时长过滤：" />
							<p:inputText id="startTimeLength" value="#{faultTimeAnalysisController.startTimeLength}"
								placeholder="0.0" style="padding-right:3px;width:80px;" />
							<!--  -->
							<p:outputLabel value="——" />
							<p:inputText id="endTimeLength" value="#{faultTimeAnalysisController.endTimeLength}"
								placeholder="0.0" style="padding-right:3px;width:80px;" />
							<p:commandButton style="margin-left:20px;" value="过滤" icon="ui-icon-search"
								update="avgTimeForm:avgTimeTab" actionListener="#{faultTimeAnalysisController.search}" />
							<!--   -->

							<p:commandButton value="重置" icon="ui-icon-refresh"
								update="avgTimeForm:avgTimeTab  startTimeLength endTimeLength"
								actionListener="#{faultTimeAnalysisController.reset}" />


							<p:commandButton value="关闭" icon="ui-icon-disk" validateClient="true"
								oncomplete="PF('avgTimeDlg').hide()" />
						</f:facet>
					</p:toolbar>
					<p:dataTable value="#{faultTimeAnalysisController.avgTimeTable}" scrollable="true" var="item"
						id="avgTimeTab" emptyMessage="无记录" rowIndexVar="ite">
						<p:column width="40" headerText="序号">
							<h:outputText value="#{ite+1}" />
						</p:column>
						<!-- <p:column headerText="公司">
							<p:outputLabel value="#{item.company}" />
						</p:column> -->
						<p:column width="170" headerText="时间">
							<p:outputLabel value="#{item.date}" />
							<!-- <p:outputLabel value="-#{record.month}" rendered="#{record.month != null}" /> -->
						</p:column>
						<!-- <p:column headerText="电压等级(kV)">
							<p:outputLabel value="#{item.voltage}" />
						</p:column> -->
						<p:column headerText="设备" width="170">
							<p:outputLabel value="#{item.equipment}" />
						</p:column>
						<p:column headerText="相别" width="80">
							<p:outputLabel value="#{item.faultPhase}" />
						</p:column>
						<p:column headerText="原因" width="80">
							<p:outputLabel value="#{item.faultReason}" />
						</p:column>
						<p:column headerText="类型" width="80">
							<p:outputLabel value="#{item.faultType}" />
						</p:column>
						<p:column headerText="时长" width="120">
							<p:outputLabel
								rendered="#{(faultTimeAnalysisController.colorStatus)and(faultTimeAnalysisController.startTimeLength!=null)and(faultTimeAnalysisController.endTimeLength!=null)}"
								style="color:#{(item.firstFault>=faultTimeAnalysisController.startTimeLength)and(faultTimeAnalysisController.endTimeLength>=item.firstFault)?'red':'black'}"
								value="#{item.firstFault}" />
							<p:outputLabel
								rendered="#{(faultTimeAnalysisController.colorStatus)and((faultTimeAnalysisController.startTimeLength==null)||(faultTimeAnalysisController.endTimeLength==null))}"
								style="color:#{(item.firstFault>=faultTimeAnalysisController.startTimeLength)||(faultTimeAnalysisController.endTimeLength>=item.firstFault)?'red':'black'}"
								value="#{item.firstFault}" />
							<p:outputLabel rendered="#{!faultTimeAnalysisController.colorStatus}"
								value="#{item.firstFault}" />
						</p:column>
					</p:dataTable>
				</p:dialog>
			</h:form>
			<h:form id="detailFrom">
				<p:dialog id="detailDialog" widgetVar="detailDialog" header=" 详细" width="1200" height="700"
					modal="true">
					<div class="tab-content" style="padding: 0;">
						<div class="chart" id="tableDiv" style="position: relative;">
							<table id="detailTable" class="table table-gray" style="width: 100%;word-break:break-all;">
							</table>
						</div>
					</div>
				</p:dialog>
			</h:form>
		</div>
	</ui:define>
	<ui:define name="contentend">
		<script src="#{request.contextPath}/resources/js/jquery-migrate.min.js"></script>
		<script src="#{request.contextPath}/resources/plugins/datatables/jquery.dataTables.min.js" />
		<script src="#{request.contextPath}/resources/plugins/datatables/dataTables.bootstrap.min.js" />
		<script src="#{request.contextPath}/resources/js/tables/mytable.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/charts.js" />
		<script src="#{request.contextPath}/resources/plugins/echarts/echarts.js" />
		<script src="#{request.contextPath}/resources/js/array-util.js" />
		<script src="#{request.contextPath}/resources/plugins/jQueryUI/jquery-ui.js" />
		<script src="#{request.contextPath}/resources/bootstrap/js/bootstrap-datetimepicker.min.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/pieChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/radarChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/category2YLineChart.js" />
		<script src="#{request.contextPath}/resources/js/mycharts/categoryLineChart.js" />
		<script src="faultTimeAnalysis.js" />
	</ui:define>
</ui:composition>